﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TT.Runtime
{
    public class TTLib
    {
        public string name;//库名称
        public List<string> srcfilename = new List<string>();//源码
        public List<string> dependlibs = new List<string>();//依赖库的名字
        public List<Type.IType> listTypes = new List<Type.IType>();
        public List<Function.TTFunc> listFuncs = new List<Function.TTFunc>();
        public List<TTVar> listVars = new List<TTVar>();
        public List<TTConstData> listConsts = new List<TTConstData>();
    }


    //变量（仅全局变量）
    public class TTVar
    {
        public bool export;//是否为外部公开值
        public Type.IType type;
        public string name;
    }
    //常量初始化值
    public class TTConstData
    {
        byte[] data;
    }

    public enum SymbolType
    {
        Variable,
        Function,
        Struct,
        Class,
    }
    //导出符号
    public class Symbol
    {
        public SymbolType type;
        public string name;//可以是变量 函数 结构 类
        public TTLib fromlib;
    }
    //执行环境 临时 写在这里
    public class TTEnv
    {
        public List<TTLib> libs = new List<TTLib>();//所有的库
        public Dictionary<string, Symbol> exports = new Dictionary<string, Symbol>();
        void AddLibPath(string path)
        {

        }
        void LoadLib(string name)
        {

        }
        //TTContext CreateContext()
        //{

        //}
        //UInt32 HeapNew()//创建一个堆对象
        //{

        //}
    }
    public class TTContext
    {

    }
}
